package top.zhangjianyong.thread;

import lombok.*;
import lombok.experimental.Accessors;

import java.util.concurrent.TimeUnit;

/**
 * 线程池配置
 *
 * @author zhangjianyong
 * @since 2024/6/15 下午3:54
 */
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Accessors(chain = true)
public class ThreadPoolConfig {
    private int corePoolSize;
    private int maxPoolSize;
    private int keepAliveTime;
    private TimeUnit timeUnit;
    private int queueCapacity;

    public static ThreadPoolConfigBuilder threadPoolConfigBuilder() {
        return new ThreadPoolConfigBuilder();
    }

    public static void main(String[] args) {
        ThreadPoolConfig threadPoolConfig =
                new ThreadPoolConfigBuilder()
                        .corePoolSize(3)
                        .maxPoolSize(10)
                        .keepAliveTime(1)
                        .timeUnit(TimeUnit.SECONDS)
                        .queueCapacity(100)
                        .build();


    }
}
